﻿<UserControl x:Class="GSF.PhasorProtocols.UI.UserControls.HomeUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:tsf="clr-namespace:GSF.TimeSeries.UI;assembly=GSF.TimeSeries.UI.WPF"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:tsfBinding="clr-namespace:GSF.TimeSeries.UI.Binding;assembly=GSF.TimeSeries.UI"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
       
        <Grid.RowDefinitions>
            <RowDefinition Height="10*"/>            
            <RowDefinition Height="13*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2.5*"/>
        </Grid.ColumnDefinitions>

        <GroupBox Header="Quick Links" Grid.Row="0" Grid.Column="0">
            <StackPanel Orientation="Vertical" >
                <Button Content="Graph Measurements" Tag="GSF.PhasorProtocols.UI.UserControls.InputStatusMonitorUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button Content="Stream Statistics" Tag="GSF.PhasorProtocols.UI.UserControls.RealTimeStatisticUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button x:Name="ButtonInputWizard" Content="Input Device Wizard" Tag="GSF.PhasorProtocols.UI.UserControls.InputWizardUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button Content="Browse Input Devices" Tag="GSF.PhasorProtocols.UI.UserControls.DeviceListUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button Content="Concentrator Output Streams" Tag="GSF.PhasorProtocols.UI.UserControls.OutputStreamUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button Content="Remote System Console" Tag="GSF.TimeSeries.UI.UserControls.MonitoringUserControl" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
                <Button Content="Restart Service" Tag="Restart" x:Name="ButtonRestart" Width="180" Height="32" FontWeight="Bold" Click="ButtonQuickLink_Click"/>
            </StackPanel>
        </GroupBox>

        <Grid Grid.Row="0" Grid.Column="1">   
            
            <!--<Grid.Resources>
                <Style TargetType="chartingToolkit:LineDataPoint">
                    <Setter Property="Background" Value="Blue"/>
                    <Setter Property="Visibility" Value="Collapsed"/>                    
                </Style>
                <Style TargetType="Polyline">
                    <Setter Property="StrokeThickness" Value="1"/>
                </Style>
            </Grid.Resources>-->
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <ComboBox x:Name="ComboBoxDevice" Margin="0,0,5,0" SelectionChanged="ComboBoxDevice_SelectionChanged" DisplayMemberPath="Value" Width="Auto" MinWidth="150"/>
                <ComboBox x:Name="ComboBoxMeasurement" Margin="0,0,5,0" SelectionChanged="ComboBoxMeasurement_SelectionChanged" DisplayMemberPath="PointTag" SelectedValuePath="SignalID" Width="Auto" MinWidth="150"/>                
            </StackPanel>

            <d3:ChartPlotter Name="ChartPlotterDynamic" Grid.Row="1" Margin="2" Height="225" Width="590" MainHorizontalAxisVisibility="Collapsed">                
            </d3:ChartPlotter>          

        </Grid>
        
        <GroupBox Header="Current Configuration" Grid.Row="1" Grid.Column="0">
            
            <Grid >

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="1.6*"/>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <TextBlock Text="Instance Type" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockInstance" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left"/>

                <TextBlock Text="Server Time" Grid.Row="1" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockServerTime" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left"/>

                <TextBlock Text="Local Time" Grid.Row="2" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockLocalTime" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"/>

                <TextBlock Text="Current User" Grid.Row="3" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockUser" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" TextWrapping="Wrap"/>
                
                <TextBlock Text="Version Information" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Left" FontWeight="Bold"/>
                
                <TextBlock Text="Server" Grid.Row="5" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockVersion" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left"/>

                <TextBlock Text="Manager" Grid.Row="6" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockManagerVersion" Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left"/>

                <TextBlock Text="Database Information" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" FontWeight="Bold"/>
                <TextBlock Text="Type" Grid.Row="8" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockDatabaseType" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left" TextWrapping="Wrap"/>

                <TextBlock Text="Name" Grid.Row="9" Grid.Column="0" FontWeight="Bold"/>
                <TextBlock x:Name="TextBlockDatabaseName" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Left" TextWrapping="Wrap"/>

                <Button Content="System Status" Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" Width="160" Height="32" FontWeight="Bold" VerticalAlignment="Bottom"
                        Click="ButtonStatus_Click"/>

            </Grid>

        </GroupBox>

        <GroupBox x:Name="GroupBoxSystemHealth" Header="System Health" Grid.Row="1" Grid.Column="1">
        
            <StackPanel Orientation="Vertical">
                <tsf:TsfPopup x:Name="PopupStatus" Topmost="False" Placement="Center">
                    <Border CornerRadius="5" BorderThickness="2" Background="White" BorderBrush="Blue">
                        <StackPanel Orientation="Vertical">
                            <GroupBox x:Name="GroupBoxStatus" Header="System Status">
                                <ScrollViewer Margin="2" Height="275" 
                                        VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" VerticalContentAlignment="Top">
                                    <ScrollViewer.Content>
                                        <TextBlock x:Name="TextBlockStatus" FontFamily="Courier New" FontSize="12" HorizontalAlignment="Left" TextAlignment="Left" TextWrapping="Wrap"/>
                                    </ScrollViewer.Content>
                                </ScrollViewer>
                            </GroupBox>
                            <Button x:Name="ButtonClose" Content="Close" HorizontalAlignment="Right" Click="ButtonClose_Click"/>
                        </StackPanel>
                    </Border>
                </tsf:TsfPopup>
                
                <TextBlock x:Name="TextBlockSystemHealth" FontFamily="Courier New" FontSize="12" HorizontalAlignment="Left" TextAlignment="Left" TextWrapping="Wrap"/>
            
            </StackPanel>
        
        </GroupBox>

    </Grid>

</UserControl>
